Skip to content

refactor: slash-and-burn Problem block built-in implementation (slash-n-burn #37819) - #38751

Open
irfanuddinahmad wants to merge 11 commits into
masterfrom
irfanuddinahmad/slash-and-burn-problem-block
Open

irfanuddinahmad wants to merge 11 commits into
masterfrom
irfanuddinahmad/slash-and-burn-problem-block

Conversation

@irfanuddinahmad

@irfanuddinahmad irfanuddinahmad commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Removes the built-in Problem (capa) XBlock.

Part of the Slash-n-Burn Built-In XBlocks epic. Closes openedx/public-engineering#540.

Merge status: ✅ approved (farhan, 2026-12-01). Merge after openedx/xblocks-core#320 (the MathJax v4 spec ports; rebased onto xblocks-core main on 12-01, CI green, review requested from farhan and navinkarkera). Rebased onto master d6fc634388 (xblocks-core 4.0.3, which includes the 4.0.1 symbolicresponse sandbox fix); head 98996f0887, CI green.
Known gaps: none introduced here. Not verified: the codejail service path (CODE_JAIL_REST_SERVICE_REMOTE_EXEC), which needs an AppArmor 4 Linux host. Scripted problems need a remote codejail service (xblocks-core ≥ 3.0), which the local stack can't run; they last graded correctly on 2026-11-12 (xblocks-core 2.0.0).
Follow-ups: #39468 (the rest of the jasmine-imagediff wiring); openedx/xblocks-core#350 (removing the hard-coded can_execute_unsafe_code).
Translations: ✅ the block catalog works (openedx/xblocks-core#329, openedx/openedx-translations#85196, openedx/xblocks-core#336).

Translations in detail

openedx/xblocks-core#329 and openedx/openedx-translations#85196 are merged. On a local Tutor stack (2026-11-19), pull_xblock_translations + compile_xblock_translations give xblock_problem its own catalog (ar, es_419 and fr fully translated), and the block's i18n service loads it at runtime. Its JS strings and the codejail error messages in remote_exec.py also use the block catalog: openedx/xblocks-core#336 is in xblocks-core 4.0.0, and openedx/xblocks-core#332 is closed.

Changes

Removed

  • Built-in block: xmodule/capa_block.py (2433 LOC: _BuiltInProblemBlock and the shim), ProblemBlockDisplay.css, the ProblemBlockDisplay webpack entry, and the USE_EXTRACTED_PROBLEM_BLOCK toggle.
  • Built-in JS: xmodule/js/src/capa/ (display.js, imageinput.js, schematic.js, and its .gitignore, so the folder goes), and the unused 'capa/display' RequireJS alias in lms/static/lms/js/spec/main.js.
  • JS fixtures only the deleted specs loaded: problem*.html, {checkbox,codeinput,jsinput,matlabinput,radiobutton}_problem.html, and imageinput.html/.underscore. xblock_problem has its own copies, and MatlabInput no longer exists.
  • Spec support only the deleted capa specs used:
    • In xmodule/js/spec/helper.js: the problem_get stub (it read the deleted problem_content.html), and the /calculate and problem_(check|reset|show|save) stubs.
    • jasmine-imagediff in the xmodule Karma configs. Its only user was toImageDiffEqual in the deleted display_spec.js.

Not in this diff: the xmodule/capa/safe_exec/remote_exec.py shim. This PR had kept it per review, but master removed it in feanil's codejail cleanup (#39429, 7b0dc2c772), as planned in #39427. Master also already points CODE_JAIL_REST_SERVICE_REMOTE_EXEC at xblock_problem.

Changed

  • The problem entrypoint in pyproject.toml now points at xblock_problem:ProblemBlock instead of xmodule.capa_block:ProblemBlock. The name stays because xblocks-core only registers _problem_extracted (for testing), and existing problem content needs it.

Modified

  • Every ProblemBlock, SHOWANSWER and generate_report_data import and patch target now uses xblock_problem.
  • xmodule/assets/README.rst no longer lists ProblemBlock as a builtin-webpack example.
  • The xmodule/js/src/sequence/display.js comment points at xblock_problem/assets/static/js/display.js in xblocks-core.
  • The test_delay_between_attempts.py docstrings say where test_capa_block.py lives now.

The removal of 7 leftover JS fixtures, the .gitignore and the alias, and the README, comment and docstring changes came from farhan's reviews (2026-11-30 and 2026-12-01).

Tests

Test Where it is now
xmodule/tests/test_capa_block.py (140 tests, imported _BuiltInProblemBlock) Moved to xblocks-core src/xblock_problem/tests/test_capa_block.py: same names, near-identical bodies (compared one by one)
xmodule/js/spec/capa/display_spec.js, imageinput_spec.js + fixtures, the pre-MathJax-v4 specs Moved to xblocks-core src/xblock_problem/assets/spec/: same names, except 2 renamed in xblocks-core: convert jax to MathML by its MathJax v4 port (c5fb2e4), and Submitting an xqueue-graded problem by the XQueue/MATLAB removal (a30b509). Both have equivalent bodies. 1 not ported on purpose (below)
The 9 specs added by #33555 (MathJax v4) openedx/xblocks-core#320 (mapping below)
lms/djangoapps/grades/tests/integration/test_problems.py Kept: it tests the platform's grades pipeline, now against xblock_problem.ProblemBlock. Supersedes openedx/xblocks-core#266 (details below)
The one JS spec not ported

updateMathML › when there is an exception › should queue up the exception tests the exception.restart retry. That is a MathJax v2 MathJax.Callback concept with no v4 equivalent. feanil flagged the branch as dead in the v4 review (openedx/xblocks-core#270), and xblocks-core 2d0c0ff removed it and its test.

MathJax v4 spec mapping (#33555 → openedx/xblocks-core#320)
Platform test (#33555) Counterpart in openedx/xblocks-core#320
should clear and typeset the math element moved unchanged (display_spec.js)
wraps calculator input in backticks for input.math moved unchanged
clears preview and skips typesetPromise on empty input moved unchanged
bind the formulaequationinput existing: makes a request on user input (formula_equation_preview_spec.js) and does not bind refreshMath to formula equation inputs
wraps calculator syntax in backticks for formulaequationinput FormulaEquationTest.test_formcalc_ajax_calculator_syntax_renders_as_latex
preserves explicit TeX delimiters \(...\) test_formcalc_ajax_inline_tex_delimiters_rejected
preserves display math TeX delimiters \[\] test_formcalc_ajax_display_tex_delimiters_rejected
preserves double-dollar delimiters test_formcalc_ajax_double_dollar_delimiters_rejected
preserves single-dollar delimiters test_formcalc_ajax_single_dollar_delimiters_rejected

The last 6 platform tests covered the built-in block's client-side refreshMath rendering of formula-equation previews. That path doesn't run on master (toggle True) and is removed here. The extracted block renders these previews only on the server, on purpose, through preview_formcalc and formula_equation_preview.js (xblocks-core 989ae32). So their counterparts assert what that path does for the same inputs.

Changes to the kept grades tests
  • reset_class(), the toggle overrides and the BuiltIn twins are dropped.
  • Review nit from refactor: slash-and-burn Word Cloud BuiltIn XBlock #38745: the toggle-era base class + __test__ = True subclass is collapsed back into TestMultipleProblemTypesSubsectionScores, TestVariedMetadata and TestWeightedProblems, the class names used before the toggle.
  • Test bodies are unchanged.

Release notes: one Willow dev/op entry covers all 8 blocks (Willow - Operator Dev Notes); the docs maintainers move it to docs.openedx.org after the release is cut (at their request, from openedx/docs.openedx.org#1554).

Epic Step 1: Post-extraction commit review

The toggle was flipped on 2026-04-24 (53d3d5dbdf). 9 later commits touched the deleted files; all are matched in xblocks-core 4.0.0 or later, or need nothing (details below). All 140 tests in master's test_capa_block.py exist in xblocks-core with the same names. Their differences are patch targets, location → usage_key, f-strings and line wrapping; every assertion is equivalent.

Nothing to port.

Later commits and their xblocks-core equivalents

Test plan

Re-verified on 2026-12-02 on this PR's own head (98996f0887) with the xblocks-core it pins (4.0.3), on a local Tutor nightly, as a non-staff learner where it matters, because PR sandboxes aren't reachable (open-craft/pr-sandbox-automation#28). Library checks that day used the REST API; the library UI checklist below last ran on 2026-11-11/12 (xblocks-core 2.0.0), and the code involved has changed little since. A box is ticked only if that flow actually ran.

  • LMS student view
  • CMS course unit
  • CMS V2 Library (10/14 checks, see below)
  • Python-evaluated problem through codejail: the codejail service wasn't exercised (needs an AppArmor 4 Linux host). The setting resolves to xblock_problem.capa.safe_exec.remote_exec.send_safe_exec_request_v0. Scripted and randomized problems last graded correctly on 2026-11-12 (details below)
  • Automated: grades/tests/integration/test_problems.py, test_tasks_helper.py, test_contentstore.py, test_block_render.py, test_library_content.py, test_item_bank.py, test_delay_between_attempts.py, show_answer/tests/, test_crud.py (all passed locally); npm run build
Testing notes and edge cases
  • Full run (2026-11-25): the 1085 tests in the 32 touched test files pass, and every block renders in the LMS and as a Studio preview, inline and as a pointer tag. Earlier runs used master 6f85d63c7f + xblocks-core 2.0.0, through the REST APIs and a headless browser.
  • Since the last full run: the rebases onto 811e38cad9 and d6fc634388 (xblocks-core 4.0.3) and the review cleanups (JS fixtures, .gitignore, RequireJS alias, spec helpers, README, comments) weren't re-tested locally. CI on this head covers them.
  • Learner flow (multiple choice, 2026-11-12): render, a wrong answer with its choice hint, a right answer (1/1), a demand hint, show answer with the solution, and reset all work in the LMS.
  • Authoring: markdown and OLX problems save, reopen and preview (through the API).
  • MathJax v4: renders on the reused copy in the LMS (1 mjx-container).
  • Scripted and randomized problems: on 2026-11-12 (xblocks-core 2.0.0), with local unsandboxed execution on test courses only, a scripted problem graded correctly on the course block and on the library-reused copy, and a randomized one reused from a library re-randomized after reset (7 → 16). That mode has since been removed. Now scripted problems need the remote codejail service, which the local stack can't run, so there they show "Could not format HTML for problem" (in a course or a V2 library; master behaves the same).
  • Grades: the kept grades/tests/integration/test_problems.py (224 tests) passes.
  • Export vs built-in (L10, 2026-11-19): the same OLX course (every block type, inline and as a pointer tag) was imported and exported on master with USE_EXTRACTED_*_BLOCK = False (built-in) and on this branch. The problem files and its unit are identical.
  • Not covered: the codejail service itself (needs an AppArmor 4 Linux host), the max-attempts lockout, MathJax in the library preview, and the editor-picker UI.
V2 Library checklist: 10/14 pass (R1–R4 partly verified)

Content libraries have historically been the most fragile area for extracted blocks (openedx/xblocks-core#123, #132, #243, #274).

  • L1. Create the block in a V2 library; the preview renders with no 500 or console errors
  • L2. Edit → save → reload → reopen the editor: every field kept its value
  • L3. Publish the component; its status changes to Published
  • L4. Copy, then paste into the library and into a course unit
  • L5. In a library unit, add the block as new and as existing library content (watch for "There was an error linking the content to this container", [Test failure] TC-00338: Libraries: Unable to add existing component to a unit wg-build-test-release#556)
  • L6. Reuse in a course through "Library content" and as a reused library unit; it renders in Studio and the LMS
  • L7. Sync: accept an update in the course, and ignore one
  • L8. Override the title on the reused copy
  • L9. Library search by content type finds the block
  • L10. OLX pointer and inline import, pointer export, and export diff against master (see testing notes)
  • R1. Author a problem in a library with each editor (simple, advanced OLX, markdown); each saves, reopens in the same editor and previews: markdown and OLX content save, reopen and preview (API); the editor-picker UI wasn't exercised
  • R2. Math (MathJax v4) renders in the library preview and on the reused copy: renders on the reused copy in the LMS (1 mjx-container); the library preview wasn't checked in a browser
  • R3. On the reused copy in the LMS, answering, grading, hints, show answer, reset and max attempts work: all pass except max-attempts lockout, which wasn't tested
  • R4. A Python-scripted / randomized problem reused from the library runs through codejail and re-randomizes: not through codejail. On 2026-11-12 (xblocks-core 2.0.0), with local unsandboxed execution, it graded correctly in the LMS and re-randomized after reset (7 → 16)

Sources: the Aximprovements manual test doc (Extracted Block Tests tab), the Ulmo test sheet's library cases, and for R1–R4, the Problem testing notes on #38152. Generated using Claude Code.

Re-verification screenshots (2026-12-02, this PR's head)
LMS learner: MC graded, MathJax Library-reused copy graded
problem_lms_graded problem_lms_reused_graded
Studio course unit V2 library preview
problem_studio_unit problem_lib_preview
Screenshots (LMS, Studio unit, V2 Library; local Tutor, 2026-11-12)

All images: irfanuddinahmad/edx-platform@snb-smoke-screenshots/38751.

LMS student view (imported block) Studio course unit (authoring MFE)
lms_inline studio_unit
V2 library home V2 library component preview (a problem without a script; re-taken 2026-11-30)
library_home lib_preview
LMS: copy reused from the library (after sync + title override) LMS: library-reused problem with MathJax
lms_reused problem_mathjax_lms

The library preview first showed a scripted problem, which rendered "Could not format HTML for problem". That isn't a regression: scripted problems need a remote codejail service on xblocks-core ≥ 3.0, which the local stack can't run (in a course or a V2 library; master behaves the same).

Settings

# Workaround for open-craft/pr-sandbox-automation#28: the openedx-permissions image name gets mangled.
DOCKER_IMAGE_PERMISSIONS: docker.io/overhangio/openedx-permissions:23.0.0-main

🤖 Generated with Claude Code

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Jun 11, 2026
@openedx-webhooks

openedx-webhooks commented Jun 11, 2026 •

Copy link
Copy Markdown

Thanks for the pull request, @irfanuddinahmad!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform-oncall.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Jun 11, 2026
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-problem-block branch from fcc939b to 356dc98 Compare June 11, 2026 12:53
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Jun 11, 2026
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-problem-block branch 2 times, most recently from 46e90c6 to bebc423 Compare June 12, 2026 16:55
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-problem-block branch from bebc423 to 544f32e Compare June 22, 2026 11:17
@irfanuddinahmad irfanuddinahmad changed the title feat: slash-and-burn Problem block built-in implementation refactor: slash-and-burn Problem block built-in implementation (slash-n-burn #37819) Jun 22, 2026
@mphilbrick211 mphilbrick211 moved this from Ready for Review to Waiting on Author in Contributions Aug 20, 2026
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-problem-block branch from 5d222d0 to c0260d6 Compare November 4, 2026 11:24
@mphilbrick211 mphilbrick211 moved this from Waiting on Author to Ready for Review in Contributions Nov 4, 2026
@irfanuddinahmad irfanuddinahmad added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Nov 5, 2026
irfanuddinahmad added a commit to irfanuddinahmad/xblocks-core that referenced this pull request Nov 6, 2026
…pecs

openedx/openedx-platform#33555 added six specs for the built-in block's
client-side refreshMath formula-equation preview, which
openedx/openedx-platform#38751 removes. The extracted block renders these
previews only via the server (preview_formcalc, 989ae32), so add tests
asserting that path's behavior for the same inputs:

- calculator syntax R_1*R_2/R_3 renders as LaTeX
- \(..\), \[..\], $$..$$ and $..$ inputs are rejected with a parse error

The binding spec maps to existing coverage (formula_equation_preview_spec
'makes a request on user input' and display_spec 'does not bind
refreshMath to formula equation inputs').

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-problem-block branch from c0260d6 to 67f3d09 Compare November 6, 2026 10:10
irfanuddinahmad added a commit to irfanuddinahmad/xblocks-core that referenced this pull request Nov 10, 2026
Ports three tests that openedx/openedx-platform#33555 (MathJax v4
upgrade) added to xmodule/js/spec/capa/display_spec.js, which
openedx/openedx-platform#38751 removes along with the built-in Problem
block:

- should clear and typeset the math element
- wraps calculator input in backticks for input.math
- clears preview and skips typesetPromise on empty input

Names, bodies and assertions are unchanged except for the extracted
block's Problem(runtime, element) constructor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
irfanuddinahmad added a commit to irfanuddinahmad/xblocks-core that referenced this pull request Nov 10, 2026
…pecs

openedx/openedx-platform#33555 added six specs for the built-in block's
client-side refreshMath formula-equation preview, which
openedx/openedx-platform#38751 removes. The extracted block renders these
previews only via the server (preview_formcalc, 989ae32), so add tests
asserting that path's behavior for the same inputs:

- calculator syntax R_1*R_2/R_3 renders as LaTeX
- \(..\), \[..\], $$..$$ and $..$ inputs are rejected with a parse error

The binding spec maps to existing coverage (formula_equation_preview_spec
'makes a request on user input' and display_spec 'does not bind
refreshMath to formula equation inputs').

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-problem-block branch from 67f3d09 to dd17204 Compare November 10, 2026 10:26
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-problem-block branch from f290955 to 31a3cd3 Compare November 25, 2026 14:16
@irfanuddinahmad irfanuddinahmad removed the create-sandbox open-craft-grove should create a sandbox environment from this PR label Nov 25, 2026

@farhan farhan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done with the first pass

@@ -1,1482 +0,0 @@
/* global MathJax, Collapsible, interpolate, JavascriptLoader, Logger, CodeMirror */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things still point at this deleted file:

  • xmodule/js/src/capa/.gitignore is now the only file left in xmodule/js/src/capa/, and it un-ignores the 3 JS files this PR deletes. Please remove it so the folder goes too.
  • lms/static/lms/js/spec/main.js:97 still has the RequireJS alias 'capa/display': 'xmodule_js/src/capa/display'. Nothing requires it, so it can go.
  • xmodule/js/src/sequence/display.js:399 has the comment see ../capa/display.js. Please point it at xblock_problem/assets/static/js/display.js in xblocks-core.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3227f88: deleted xmodule/js/src/capa/.gitignore (the folder is gone now), removed the 'capa/display' alias from lms/static/lms/js/spec/main.js, and the sequence/display.js comment now points at xblock_problem/assets/static/js/display.js in openedx/xblocks-core.

Generated using Claude Code

@@ -1,8 +0,0 @@
<section class='xblock xblock-student_view xmodule_display xmodule_CapaModule'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem*.html fixtures are removed, but 7 more fixtures were only used by the deleted capa specs and are still there: checkbox_problem.html, codeinput_problem.html, jsinput_problem.html, matlabinput_problem.html, radiobutton_problem.html, imageinput.html and imageinput.underscore (all in xmodule/js/fixtures/). Please delete them too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: all 7 deleted (in 247d1d7e7e after the rebase, before this review landed). xblock_problem has its own copies of the ones its specs use, and MatlabInput is gone everywhere.

Generated using Claude Code

Comment thread xmodule/capa_block.py
@@ -1,2432 +0,0 @@
# pylint: disable=too-many-lines

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xmodule/assets/README.rst:53,66 still lists ProblemBlock as an example of the builtin-webpack setup and links to this file. The block no longer uses that setup, so please drop both lines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3227f88: both ProblemBlock lines removed from xmodule/assets/README.rst.

Generated using Claude Code

from xblock.scorable import Score

from xmodule.capa_block import ProblemBlock
from xblock_problem import ProblemBlock

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the module docstring (line 4) and the CapaFactoryWithDelay docstring (line 32) still refer to test_capa_block.py. That file is deleted here and now lives in xblocks-core (src/xblock_problem/tests/test_capa_block.py). Could you update the wording?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3227f88: both docstrings now say test_capa_block.py lives in xblocks-core at src/xblock_problem/tests/test_capa_block.py.

Generated using Claude Code

@farhan

farhan commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Thanks! A couple of asks for the next push:

  1. Please rebase onto master and bump to the latest xblocks-core (master is on 4.0.3, which includes the symbolicresponse sandbox fix).
  2. Once the review suggestions are in, please refresh the PR description so it matches the current state (base commit, xblocks-core version, and what was changed in response to review).

@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-problem-block branch from d334e25 to 3227f88 Compare November 30, 2026 11:54
@irfanuddinahmad

Copy link
Copy Markdown
Contributor Author

@farhan thanks, all addressed; head is now 3227f88e9a.

  1. Rebase: onto master 811e38cad9, which pins xblocks-core 4.0.3 (it includes the 4.0.1 symbolicresponse sandbox fix). This PR doesn't pin requirements itself, so no bump commit was needed. No conflicts; the range-diff only changes context. Master made no new commits to the files deleted here, so the Epic Step 1 review still holds.
  2. Inline comments: all 4 answered. The 7 fixtures, the src/capa/.gitignore, the capa/display alias, the README lines, the sequence/display.js comment and the test_delay_between_attempts.py docstrings are all done.
  3. Description: refreshed: base commit and xblocks-core version, a Changed in review list, and the new Deleted/Modified entries. It also records one JS spec that isn't ported: updateMathML › when there is an exception › should queue up the exception, which tests the MathJax v2 exception.restart retry. feanil flagged that branch as dead in the v4 review (feat(mathjax): upgrade mathjax from v2 to v4 xblocks-core#270), and xblocks-core 2d0c0ff removed it.

openedx/xblocks-core#320 (the MathJax v4 spec ports) is still open and should merge first. CI is running on the new head.

Generated using Claude Code

irfanuddinahmad added a commit to irfanuddinahmad/edx-platform that referenced this pull request Nov 30, 2026
…lem (2026-11-30)

The previous image showed a scripted problem, which needs a remote
codejail service that the local stack doesn't run.
@farhan

farhan commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

@irfanuddinahmad Please rebase and resolve conflicts

@farhan farhan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, but it needs rebase and conflicts needs to be resolved.

Irfan Ahmad and others added 10 commits December 1, 2026 15:33
Removes the built-in ProblemBlock shim and all associated assets now that
the extracted xblocks_contrib.problem.ProblemBlock is the production implementation.

- Delete xmodule/capa_block.py (_BuiltInProblemBlock + shim)
- Delete xmodule/capa/ (deprecated safe_exec shim pointing to xblocks_contrib)
- Delete xmodule/js/src/capa/ JS files (display, imageinput, schematic)
- Delete xmodule/static/css-builtin-blocks/ProblemBlockDisplay.css
- Delete xmodule/tests/test_capa_block.py (tested _BuiltInProblemBlock directly)
- Delete lms/djangoapps/grades/tests/integration/test_problems.py (used reset_class shim)
- Remove USE_EXTRACTED_PROBLEM_BLOCK toggle from openedx/envs/common.py
- Update CODE_JAIL_REST_SERVICE_REMOTE_EXEC to xblocks_contrib path
- Remove problem entrypoint from pyproject.toml
- Remove ProblemBlockDisplay webpack entry
- Update all ProblemBlock/SHOWANSWER imports to xblocks_contrib.problem

Part of epic #37819

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nfig.js

ProblemBlockDisplay (the only webpack entry including capa/display.js,
capa/imageinput.js, and capa/schematic.js) and those JS files are deleted
in this PR. Remove the now-dead imports-loader rules for consistency with
how Poll, WordCloud, and LTI PRs handle their own cleanup.
Also removes the stale capa/display.js example from the comment above the
imports-loader block since that example is no longer in the codebase.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…blemBlock

These grades-pipeline integration tests already ran against the extracted
ProblemBlock (USE_EXTRACTED_PROBLEM_BLOCK=True). The grades pipeline lives
in openedx-platform, so the coverage belongs here rather than in
xblocks-core (supersedes the port tracked in openedx/xblocks-core#266).

Only the reset_class() calls, toggle overrides and BuiltIn variants are
removed; test names and logic are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xblocks-core 2.0.0 (#38473) removed the xblocks_contrib package. Point the
platform entrypoint, imports and mock.patch targets at the new per-block
packages (e.g. xblocks_contrib.video.video -> xblock_video.block).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same nits as reviewed on #38745:
- Drop the extra blank line left in openedx/envs/common.py after the toggle removal.
- Collapse the toggle-era base class + __test__ subclass back into the
  original test class name(s). The plugin cache reset was only needed for
  the removed importlib.reload. Test bodies are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
These fixtures were only loaded by the deleted
xmodule/js/spec/capa/display_spec.js and imageinput_spec.js. The specs
moved to xblock_problem with their own copies of the fixtures
(matlabinput_problem.html is gone everywhere, since MatlabInput was
removed). Also point a stale comment in sequence/display.js at the
extracted block's display.js.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-ups:
- remove xmodule/js/src/capa/.gitignore, which only un-ignored the
  deleted capa JS files, so the folder goes away
- remove the unused 'capa/display' RequireJS alias from the LMS spec
  config
- drop ProblemBlock from the builtin-webpack examples in
  xmodule/assets/README.rst
- point the sequence/display.js comment at xblock_problem's display.js
- note where test_capa_block.py lives now in the
  test_delay_between_attempts.py docstrings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-problem-block branch from 3227f88 to f14f669 Compare December 1, 2026 10:34
@irfanuddinahmad

Copy link
Copy Markdown
Contributor Author

@farhan thanks, rebased onto master d6fc634388; head is now f14f669ed4, CI green (46/46), mergeable.

  • The conflict came from feat!: clean up after the local codejail removal #39429 (feanil's codejail cleanup). 7b0dc2c772 removed the xmodule/capa/safe_exec/remote_exec shim, so I dropped this PR's commit that had restored it. 154021763f changed the built-in capa_block.py, which this PR deletes, to pass can_execute_unsafe_code=lambda: False. Nothing to port: the extracted block gets the same False from the platform's SandboxService, which master now hard-codes (removal tracked in Drop can_execute_unsafe_code and the unsafely argument xblocks-core#350).
  • The rest of the branch is unchanged; it touches the same 39 files as before.
  • Description refreshed: base commit, the shim now listed as removed on master, and the Epic Step 1 note for 154021763f.

openedx/xblocks-core#320 (the MathJax v4 spec ports) is still open, and this PR should merge after it.

Generated using Claude Code

irfanuddinahmad added a commit to irfanuddinahmad/xblocks-core that referenced this pull request Dec 1, 2026
Ports three tests that openedx/openedx-platform#33555 (MathJax v4
upgrade) added to xmodule/js/spec/capa/display_spec.js, which
openedx/openedx-platform#38751 removes along with the built-in Problem
block:

- should clear and typeset the math element
- wraps calculator input in backticks for input.math
- clears preview and skips typesetPromise on empty input

Names, bodies and assertions are unchanged except for the extracted
block's Problem(runtime, element) constructor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
irfanuddinahmad added a commit to irfanuddinahmad/xblocks-core that referenced this pull request Dec 1, 2026
…pecs

openedx/openedx-platform#33555 added six specs for the built-in block's
client-side refreshMath formula-equation preview, which
openedx/openedx-platform#38751 removes. The extracted block renders these
previews only via the server (preview_formcalc, 989ae32), so add tests
asserting that path's behavior for the same inputs:

- calculator syntax R_1*R_2/R_3 renders as LaTeX
- \(..\), \[..\], $$..$$ and $..$ inputs are rejected with a parse error

The binding spec maps to existing coverage (formula_equation_preview_spec
'makes a request on user input' and display_spec 'does not bind
refreshMath to formula equation inputs').

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@irfanuddinahmad

Copy link
Copy Markdown
Contributor Author

@farhan the last blocker for this PR is now openedx/xblocks-core#320, which I've requested your review on (and navinkarkera's). It gives the 9 MathJax v4 specs that #33555 added to the platform display_spec.js a home in xblocks-core: 3 move unchanged, and 5 become FormulaEquationTest tests (mapping in this description). It's tests only (+95 lines in 2 files). I rebased it onto current xblocks-core main today, and CI is green, including the JS tests. Once it merges, this PR has no remaining dependency.

Generated using Claude Code

…used

- xmodule/js/spec/helper.js: stubRequests no longer fakes problem_get
  (it read problem_content.html, which this PR deletes), /calculate or
  problem_(check|reset|show|save); only the deleted capa specs made those
  requests. The goto_position and event branches stay.
- jasmine-imagediff: its only user (toImageDiffEqual) was the deleted
  capa display_spec.js, so drop it from the xmodule Karma configs. The
  wider cleanup is tracked in #39468.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
irfanuddinahmad added a commit to irfanuddinahmad/edx-platform that referenced this pull request Dec 2, 2026
irfanuddinahmad added a commit to irfanuddinahmad/edx-platform that referenced this pull request Dec 2, 2026
irfanuddinahmad added a commit to irfanuddinahmad/edx-platform that referenced this pull request Dec 2, 2026
irfanuddinahmad added a commit to irfanuddinahmad/edx-platform that referenced this pull request Dec 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

[Refactor] Slash-n-Burn Problem BuiltIn XBlock

4 participants